package com.telit.common.exception;

import com.telit.common.enums.ResultCode;
import lombok.Data;


/**
 * 自定义异常
 */
@Data
public class ForestBaseException extends RuntimeException {
    /**
     * 错误码
     */
    private String status;
    /**
     * 参数
     */
    private Object[] args;
    /**
     * 错误消息
     */
    private String defaultMessage;

    public ForestBaseException(String status, Object[] args, String defaultMessage) {
        super(defaultMessage);
        this.status = status;
        this.args = args;
        this.defaultMessage = defaultMessage;
    }

    public ForestBaseException(String status, String defaultMessage) {
        this(status, null, defaultMessage);
    }

    public ForestBaseException(String defaultMessage) {
        this(ResultCode.UNKNOWN_EXCEPTION_STATUS.getCode(), null, defaultMessage);
    }

    public ForestBaseException(String status, Object[] args) {
        this(status, args, null);
    }
}
